package Class.Basis.MobilePhone;

class Phone {
    private String brand;
    private int prise;
    private String color;

    public Phone() {
    }

    public Phone(String brand, int prise, String color) {
        this.brand = brand;
        this.prise = prise;
        this.color = color;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public int getPrise() {
        return prise;
    }

    public void setPrise(int prise) {
        this.prise = prise;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String toString() {
        return "Phone{brand = " + brand + ", prise = " + prise + ", color = " + color + "}";
    }
}

public class PhoneInformation {
    public static void main(String[] args) {
        Phone phone1 = new Phone("小米", 2000, "白色");
        Phone phone2 = new Phone("Apple", 3500, "绿色");
        Phone phone3 = new Phone("华为", 3000, "红色");

        Phone[] arr = new Phone[3];

        int sum = 0;
        double avg;

        arr[0] = phone1;
        arr[1] = phone2;
        arr[2] = phone3;

        for (int i = 0; i < arr.length; i++) {
            Phone phone = arr[i];
            sum += phone.getPrise();
        }

        avg = (double) sum / arr.length;

        System.out.println(avg);
    }
}
